
#include <wiringPi.h>  
#include <stdio.h>  
#include <sys/time.h>  

void mytimer()
{
    struct timeval start_time;
    struct timeval stop_time;
    gettimeofday(&start_time, NULL);   
    delayMicroseconds(200);
    gettimeofday(&stop_time, NULL);
    long l_time = stop_time.tv_usec - start_time.tv_usec;
    printf("l_time = %ld\n",l_time);
    long start, stop;
    start = start_time.tv_sec * 1000000 + start_time.tv_usec;   //微秒级的时间  
    stop  = stop_time.tv_sec * 1000000 + stop_time.tv_usec;
    long l_time2 = stop - start;
    printf("l_time2 = %ld\n",l_time2);
}

int main(void)
{
    wiringPiSetup();
    mytimer();
    return 0;
}
